package com.winbomb.kingcard;

/**
 * 花色的枚举类
 * 
 * @author winbomb
 * 
 */
public enum Suit {

	SPADE {
		public boolean restraintTo(Suit suit) {
			return Suit.HEART == suit;
		}

		public boolean isSameColor(Suit suit) {
			return (suit == Suit.SPADE || suit == Suit.CLUB || suit == Suit.BLACK);
		}
	},

	HEART {
		public boolean restraintTo(Suit suit) {
			return Suit.CLUB == suit;
		}

		public boolean isSameColor(Suit suit) {
			return (suit == Suit.HEART || suit == Suit.DIAMOND || suit == Suit.RED);
		}
	},

	CLUB {
		public boolean restraintTo(Suit suit) {
			return Suit.DIAMOND == suit;
		}

		public boolean isSameColor(Suit suit) {
			return (suit == Suit.SPADE || suit == Suit.CLUB || suit == Suit.BLACK);
		}
	},

	DIAMOND {
		public boolean restraintTo(Suit suit) {
			return Suit.SPADE == suit;
		}

		public boolean isSameColor(Suit suit) {
			return (suit == Suit.HEART || suit == Suit.DIAMOND || suit == Suit.RED);
		}
	},

	BLACK {
		public boolean restraintTo(Suit suit) {
			return false;
		}

		public boolean isSameColor(Suit suit) {
			return (suit == Suit.SPADE || suit == Suit.CLUB || suit == Suit.BLACK);
		}
	},

	RED {
		public boolean restraintTo(Suit suit) {
			return false;
		}

		public boolean isSameColor(Suit suit) {
			return (suit == Suit.HEART || suit == Suit.DIAMOND || suit == Suit.RED);
		}
	};

	/**
	 * 该花色是否与suit相克
	 * 
	 * @param suit
	 * @return
	 */
	public abstract boolean restraintTo(Suit suit);

	/**
	 * 是否是相同的颜色,
	 * 
	 * 大王/红桃/方块 同为红色
	 * 
	 * 小王/黑桃/梅花 同为黑色
	 * 
	 * @param suit
	 * @return
	 */
	public abstract boolean isSameColor(Suit suit);
}